Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Danger - Binomial and Poisson distributions #2385

Merged
merged 8 commits into from
Nov 4, 2023
Merged

Danger - Binomial and Poisson distributions #2385

merged 8 commits into from
Nov 4, 2023

Conversation

OAGr
Copy link
Contributor

@OAGr OAGr commented Oct 30, 2023

We don't have inv() functions for these. Also, We can't promise to display them correctly - in many cases, KDE will assume that they are partially continuous. It's not clear how to best get around this.

image

I added these as Danger.binomialDist and Danger.poissonDist. I didn't use Danger.binomial, because that was already taken.

I can add a changeset, but wanted to get a quick take first.

2 Key Questions here:

  1. Do we want to try this related soon, or before this story? Discrete distributions should stay discrete #2386
  2. Should we name these as such, or should we choose some other names?

@OAGr OAGr requested a review from berekuk as a code owner October 30, 2023 21:33
@changeset-bot
Copy link

changeset-bot bot commented Oct 30, 2023

⚠️ No Changeset found

Latest commit: 5a136d5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@OAGr OAGr temporarily deployed to Preview October 30, 2023 21:33 — with GitHub Actions Inactive
@vercel
Copy link

vercel bot commented Oct 30, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
quri-hub ✅ Ready (Inspect) Visit Preview Nov 3, 2023 11:48pm
quri-ui ✅ Ready (Inspect) Visit Preview Nov 3, 2023 11:48pm
squiggle-components ✅ Ready (Inspect) Visit Preview Nov 3, 2023 11:48pm
squiggle-website ✅ Ready (Inspect) Visit Preview Nov 3, 2023 11:48pm

@sweep-ai
Copy link
Contributor

sweep-ai bot commented Oct 30, 2023

Apply Sweep Rules to your PR?

  • Apply: All docstrings and comments should be up to date.
  • Apply: Ensure that all variables and functions have descriptive names.
  • Apply: Avoid using unnecessary separators or extra characters in code.
  • Apply: Use consistent indentation and spacing throughout the code.
  • Apply: Ensure that all code is properly formatted and follows the style guide.
  • Apply: Avoid using magic numbers or hard-coded values in the code.

Copy link
Collaborator

@berekuk berekuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, we can fix the issue with discrete in a separate PR.

packages/website/src/pages/docs/Api/Danger.md Outdated Show resolved Hide resolved
packages/website/src/pages/docs/Api/Danger.md Outdated Show resolved Hide resolved
@@ -23,7 +23,7 @@ export const kde = ({
let xWidth = kernelWidth ?? nrd0(samples);
samples = samples.filter((v) => Number.isFinite(v)); // Not sure if this is needed?
const len = samples.length;
if (len === 0) return { usedWidth: xWidth, xs: [], ys: [] };
if (len === 0 || xWidth === 0) return { usedWidth: xWidth, xs: [], ys: [] };
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My best guess about this:

  • xWidth is zero if all samples are identical, but somehow we decided to run kde on them, maybe because there are less than 5 of them (nrd0 will return 0 if variance is 0)
  • so you want to discard them because otherwise kde did something weird or failed

If so, I'm not sure if it's the best way to fix the problem (discarding samples seems bad, and this is too entangled with samplesToPointSetDist needs and other quirks). But I also don't have any better suggestions. Maybe this deserves a comment?

}

inv(p: number): number {
throw new Error("Binomial inv not implemented");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that these dists and methods really don't get used now; Danger.binomialDist gets immediately transformed to the sampleset, and there's no Sym.binomial yet.

Can you add a comment about that here if you don't want to implement these? For a real symbolic binomial dist, having inv and toPointSetDist is critical, it won't be rendered as a chart otherwise.

* main: (114 commits)
  update all remaining deps; remove ops ts fixes
  update next.js, relay and some other packages
  ⬆️ Bump nextra-theme-docs from 2.10.0 to 2.13.2
  disable update messages for storybook and prisma
  ⬆️ Bump @storybook/addon-essentials from 7.4.5 to 7.5.2
  ⬆️ Bump @codemirror/view from 6.21.2 to 6.21.4
  ⬆️ Bump @storybook/addon-actions from 7.4.5 to 7.5.2
  ⬆️ Bump tailwindcss from 3.3.3 to 3.3.5
  ⬆️ Bump @types/lodash from 4.14.199 to 4.14.200
  ⬆️ Bump @storybook/react from 7.4.5 to 7.5.2
  ⬆️ Bump nextra from 2.10.0 to 2.13.2
  ⬆️ Bump @codemirror/state from 6.2.1 to 6.3.1
  ⬆️ Bump @types/webpack-bundle-analyzer from 4.6.1 to 4.6.2
  ⬆️ Bump esbuild from 0.18.20 to 0.19.5
  ⬆️ Bump @typescript-eslint/eslint-plugin from 6.7.4 to 6.9.1
  ⬆️ Bump vite from 4.4.9 to 4.5.0
  fix builds - @types/testing-library__jest-dom is not needed anymore
  concurrency config for ci workflow
  fix clusterless relative value items
  autoRun -> autorun
  ...
Copy link

codecov bot commented Nov 3, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (7f32f37) 71.80% compared to head (5a31166) 71.46%.

❗ Current head 5a31166 differs from pull request most recent head 5a136d5. Consider uploading reports for the commit 5a136d5 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2385      +/-   ##
==========================================
- Coverage   71.80%   71.46%   -0.34%     
==========================================
  Files         113      113              
  Lines        5838     5895      +57     
  Branches     1174     1180       +6     
==========================================
+ Hits         4192     4213      +21     
- Misses       1638     1674      +36     
  Partials        8        8              

see 7 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants